﻿using System;

namespace IconPackEditor
{
    public class  Plugin : Notepad_X.Plugin.IPlugin
    {
        IconPackEditor.Application app;

        System.Windows.Forms.ToolStripMenuItem _menuItem;

        public string Name
        {
            get
            { return "Icon Pack Editor"; }
        }
        public string Author
        {
            get
            { return "NohponeX"; }
        }
        public string Description
        {
            get
            { return "Notepad X IconPack Editor"; }
        }
        public string Version
        {
            get
            { return "1.1"; }
        }

        public bool HasSettings {
            get { return true; }
        }

        public void Initialize()
        {
            _menuItem = new System.Windows.Forms.ToolStripMenuItem("Icon Pack Editor");
            if (Notepad_X.Static.MainInstance.IconsCollection.Images.ContainsKey("icons"))
            {
                _menuItem.Image = Notepad_X.Static.MainInstance.IconsCollection.Images["icons"];
            }
            _menuItem.Click += new EventHandler(_menuItem_Click);
            Notepad_X.Static.MainInstance.system_menuItem_Get("Menu_Tools").DropDownItems.Insert(2, _menuItem);
          }
        public void Settings() {
            app = new Application();
            app.Show();
        }
        void _menuItem_Click(object sender, EventArgs e)
        {
            Settings();
        }
        public void Dispose()
        {
            Notepad_X.Static.MainInstance.system_menuItem_Get("Menu_Tools").DropDownItems.Remove(_menuItem);
            if (app != null)
            {
                app.Dispose();
            }
            app = null;
        }
    }
}
